var Person = function (name, $log) {
	this.eat = function (food) {
		$log.info(name + ' is eating delicious ' + food);
	};

	this.beHungry = function (reason) {
		$log.warn(name + ' is hungry because: ' + reason);
	};
};

var Restaurant = function ($q, $scope) {
	var currentOrder;

	this.takeOrder = function (orderedItems) {
		currentOrder = {
			deferred : $q.defer(),
			items : orderedItems
		};
		return currentOrder.deferred.promise;
	};

	this.deliverOrder = function () {
		currentOrder.deferred.resolve(currentOrder.items);
	};

	this.problemWithOrder = function (reason) {
		currentOrder.deferred.reject(reason);
		//$scope.$digest();
	};
};
